require 'sqlite3'

class Squick
  LAUGH_FREQ = 8

  def oneIn(odds)
    return (rand(odds) == 0)
  end

  def laughAlong(msg)
    if(msg.match(/\:\)|\:P|D\:|\:D|O_o|o_O|o\.O|O\.o|lol|rofl|lmao|haha|hehe/)) then
      laughs = [":P", ":)", "O_O", "haha", "lol", "rofl", "lmao", ":D", "D:"]

      if oneIn(LAUGH_FREQ) then
        sleep rand(3) + 2
        return laughs[rand(laughs.length)]
      end
    end

    return nil
  end

end
